Ext.namespace("Nippy.Components.NodeEditors.Shortcut");

Nippy.Components.NodeEditors.Shortcut = Ext.extend(Nippy.Components.NodeEditors.BasicEditor, {
    /*constructor: function(config){
		Nippy.Components.NodeEditors.Shortcut.superclass.constructor.apply(this, arguments);
    }
	,*/initComponent: function(){
		//this.view.addListener('onupload',this.imageUpload,this);
		Ext.apply(this, {
		    labelWidth: 135,
		    frame:true,
		    title: 'Ярлык ('.concat(this.nodeId,')'),
		    bodyStyle:'padding:5px 5px 0',
		    width: 550,
		    defaultType: 'textfield',
            addOther: false,
		    items: [{
		            fieldLabel: 'Узел',
		            name: 'ShortcutId',
		            allowBlank: false
		        },{
		            fieldLabel: 'Публиковать в меню',
		            name: 'InMenu',
		            xtype: 'checkbox',
		            allowBlank: false,
		            inputValue: 1
		        }]
		});
		Nippy.Components.NodeEditors.Shortcut.superclass.initComponent.apply(this, arguments);
	}
	,saveClick: function(){
		var f = this.getForm();
		this.getForm().submit({
			url: '/admin/cfg-shortcut/',
			method: 'PUT',
			scope: this,
			params: {id: this.nodeId},
			failure: this.submitFailure,
			success: function(form, action){
				this.fireEvent('onsaved', this);
			}
		});
	}
	/*,fillForm: function(obj){
		var f = TesterExpert.Components.NodeEditors.CatalogueItem.superclass.fillForm.call(this,obj);
		if (obj.Images!=null){
			var s = {XmlImage: new Array()}; 
			var t=-1;
			for(var i=0;i<obj.Images.length;i++){
				if (t==-1)
					for(var j=0;j<obj.Images[i].Items.length;j++)
						if(obj.Images[i].Items[j].SizeId==obj.Images[i].ThumbID) 
							t=j;
				s.XmlImage.push(obj.Images[i].Items[t]);
			}
			this.view.getView().getStore().loadData(s);
		}
	}
	,imageUpload: function(v){
		var n =this.getForm().findField('ItemName').getValue();
		v.setAlt(n).setTitle(n);
		return true;
	}*/
});